package com.hanggold.springboot.lesson3;

import com.hanggold.springboot.lesson3.annotation.AnnotaionComposite;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

/**
 * 这里写代码描述
 *
 * @author smc
 * @date 2019-06-27 21:24
 * @since
 **/
@AnnotaionComposite
@ResponseBody
public class AnnotaionCompositeApplicaiton {

    public static void main(String[] args) throws IOException {


        String className = AnnotaionCompositeApplicaiton.class.getName();

        MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory();

        MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(className);

        AnnotationMetadata annotationMetadata =  metadataReader.getAnnotationMetadata();

        annotationMetadata.getAnnotationTypes().forEach(e->{
            annotationMetadata.getMetaAnnotationTypes(e).forEach(child->{
                System.out.println("child: "+ child);

            });
        });



    }


}
